package com.thread;

import java.lang.management.ManagementFactory;
import java.lang.management.ThreadInfo;
import java.lang.management.ThreadMXBean;
import java.util.Map;

public class TestThreadCount {

	public static void main(String[] args) {
//		Map <Thread, StackTraceElement[] > maps = Thread.getAllStackTraces();   
//		  
//		for(Map.Entry<Thread, StackTraceElement[]> entry : maps.entrySet()) {
//			Thread t = entry.getKey();
//			ThreadInfo info = threadMXBean.getThreadInfo(t.getId());   
//		}
		
		ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean(); 
		System.out.println(threadMXBean.getThreadCount());
		System.out.println(threadMXBean.getPeakThreadCount());
		System.out.println(Thread.activeCount());
		System.out.println(threadMXBean.getDaemonThreadCount());
	}

}
